<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>axiethernet: xaxiethernet_example_intr_fifo.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.gif"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">axiethernet
   </div>
   <div id="projectbrief">Xilinx SDK Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xaxiethernet__example__intr__fifo_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xaxiethernet_example_intr_fifo.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>Implements examples that utilize the Axi Ethernet's interrupt driven FIFO direct packet transfer mode to send and receive frames. </p>
<p>These examples demonstrate:</p>
<ul>
<li>How to perform simple send and receive.</li>
<li>Advanced frame processing</li>
<li>Error handling</li>
<li>Device reset</li>
</ul>
<p>Functional guide to example:</p>
<ul>
<li>AxiEthernetSingleFrameIntrExample() demonstrates the simplest way to send and receive frames in interrupt driven FIFO direct mode.</li>
<li>AxiEthernetSingleFrameNonContIntrExample demonstrates how to handle frames that are stored in more than one memory location.</li>
<li>AxiEthernetMultipleFramesIntrExample demonstrates how to defer frame reception so that CPU intensive receive functions are not performed in interrupt context.</li>
<li>AxiEthernetErrorHandler() demonstrates how to manage asynchronous errors.</li>
<li><a class="el" href="xaxiethernet__example__polled_8c.html#a56e626d72ffba0a50d6c992df0f5eb6a" title="This function resets the device but preserves the options set by the user. ">AxiEthernetResetDevice()</a> demonstrates how to reset the driver/HW while maintaining driver/HW state.</li>
</ul>
<pre>
MODIFICATION HISTORY:</pre><pre>Ver   Who  Date     Changes
<hr/>

1.00a asa  4/30/10  First release based on the ll temac driver
3.00a bss  10/22/12 Added support for Fast Interrupt Handlers.
3.01a srt  02/14/13 Added support for Zynq (CR 681136)
3.02a srt  08/06/13 Fixed CR 727634 -
                Modified FifoHandler() logic to reflect the bit
                changes in the Interrupt Status Register as per
                the latest AXI FIFO stream IP.
5.4   ms   01/23/17 Modified xil_printf statement in main function to
                    ensure that "Successfully ran" and "Failed" strings are
                    available in all examples. This is a fix for CR-965028.</pre><pre></pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxiethernet__example__intr__fifo_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is the main function for the Axi Ethernet example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br /></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a840291bc02cba5474a4cb46a9b9566fe">&#9670;&nbsp;</a></span>main()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This is the main function for the Axi Ethernet example. </p>
<p>This function is not included if the example is generated from the TestAppGen test tool.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td><pre class="fragment">    - XST_SUCCESS to indicate success.
    - XST_FAILURE.to indicate failure.
</pre> </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>
<p>This function demonstrates the usage usage of the Axi Ethernet by sending and receiving frames in interrupt driven fifo mode.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">IntcInstancePtr</td><td>is a pointer to the instance of the Intc component. </td></tr>
    <tr><td class="paramname">AxiEthernetInstancePtr</td><td>is a pointer to the instance of the Axi Ethernet component. </td></tr>
    <tr><td class="paramname">FifoInstancePtr</td><td>is a pointer to the instance of the AXIFIFO component. </td></tr>
    <tr><td class="paramname">AxiEthernetDeviceId</td><td>is Device ID of the Axi Ethernet Device , typically XPAR_&lt;AXIETHERNET_instance&gt;_DEVICE_ID value from xparameters.h. </td></tr>
    <tr><td class="paramname">FifoDeviceId</td><td>is the Interrupt ID and is typically XPAR_&lt;INTC_instance&gt;_&lt;AXIETHERNET_instance&gt;_VEC_ID value from xparameters.h. </td></tr>
    <tr><td class="paramname">AxiEthernetIntrId</td><td>is the Interrupt ID and is typically XPAR_&lt;INTC_instance&gt;_&lt;AXIETHERNET_instance&gt;_VEC_ID value from xparameters.h. </td></tr>
    <tr><td class="paramname">FifoIntrId</td><td>is the interrupt id for fifo. <pre class="fragment">    - XST_SUCCESS to indicate success.
    - XST_FAILURE.to indicate failure.
</pre></td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>AxiFifo hardware must be initialized before initializing AxiEthernet. Since AxiFifo reset line is connected to the AxiEthernet reset line, a reset of AxiFifo hardware during its initialization would reset AxiEthernet.</dd></dl>
<p>This function demonstrates the usage of the Axi Ethernet by sending and receiving a single frame in interrupt mode.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">AxiEthernetInstancePtr</td><td>is a pointer to the instance of the AxiEthernet component. </td></tr>
    <tr><td class="paramname">FifoInstancePtr</td><td>is a pointer to the instance of the Fifo component.</td></tr>
  </table>
  </dd>
</dl>
<ul>
<li>XST_SUCCESS to indicate success.</li>
<li>XST_FAILURE.to indicate failure.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>None.</dd></dl>
<p>This example sends a packet from non-contiguous memory locations. The header is stored in one area. The payload data is calculated and written to the packet FIFO one byte at a time.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">AxiEthernetInstancePtr</td><td>is a pointer to the instance of the AxiEthernet component. </td></tr>
    <tr><td class="paramname">FifoInstancePtr</td><td>is a pointer to the instance of the Fifo component.</td></tr>
  </table>
  </dd>
</dl>
<ul>
<li>XST_SUCCESS to indicate success.</li>
<li>XST_FAILURE.to indicate failure.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>None.</dd></dl>
<p>This example sends and receives a batch of frames. Frame reception is handled in this function and not in the callback function.</p>
<p>Use this method of reception when interrupt latency is important.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">AxiEthernetInstancePtr</td><td>is a pointer to the instance of the AxiEthernet component. </td></tr>
    <tr><td class="paramname">FifoInstancePtr</td><td>is a pointer to the instance of the Fifo component.</td></tr>
  </table>
  </dd>
</dl>
<ul>
<li>XST_SUCCESS to indicate success.</li>
<li>XST_FAILURE.to indicate failure.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>None.</dd></dl>
<p>This is the Receive handler callback function for examples 1 and 2. It will increment a shared counter, receive and validate the frame.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Fifo</td><td>is a reference to the Fifo device instance.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None.</dd></dl>
<p>This is the Error handler callback function and this function increments the the error counter so that the main thread knows the number of errors.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Fifo</td><td>is a reference to the AxiEthernet device instance.</td></tr>
    <tr><td class="paramname">Pending</td><td>is a bitmask of the pending interrupts.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None.</dd></dl>
<p>This is the Fifo handler function and will increment a shared counter that can be tested by the main thread of operation.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Fifo</td><td>is a reference to the Fifo instance.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None.</dd></dl>
<p>This is the Error handler callback function and this function increments the the error counter so that the main thread knows the number of errors.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">AxiEthernet</td><td>is a reference to the AxiEthernet device instance.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None.</dd></dl>
<p>This function resets the device but preserves the options set by the user.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">AxiEthernetInstancePtr</td><td>is a pointer to the instance of the AxiEthernet component. </td></tr>
    <tr><td class="paramname">FifoInstancePtr</td><td>is a pointer to the instance of the Fifo component.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>- XST_SUCCESS to indicate success.<ul>
<li>XST_FAILURE.to indicate failure.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None.</dd></dl>
<p>This function setups the interrupt system so interrupts can occur for the Axi Ethernet. This function is application-specific since the actual system may or may not have an interrupt controller. The Axi Ethernet could be directly connected to a processor without an interrupt controller. The user should modify this function to fit the application.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">IntcInstancePtr</td><td>is a pointer to the instance of the Intc component. </td></tr>
    <tr><td class="paramname">AxiEthernetInstancePtr</td><td>is a pointer to the instance of the AxiEthernet component. </td></tr>
    <tr><td class="paramname">FifoInstancePtr</td><td>is a pointer to the instance of the AXIFIFO component. </td></tr>
    <tr><td class="paramname">AxiEthernetDeviceId</td><td>is Device ID of the Axi Ethernet Device , typically XPAR_&lt;AXIETHERNET_instance&gt;_DEVICE_ID value from xparameters.h. </td></tr>
    <tr><td class="paramname">AxiEthernetIntrId</td><td>is the Interrupt ID and is typically XPAR_&lt;INTC_instance&gt;_&lt;AXIETHERNET_instance&gt;_VEC_ID value from xparameters.h. </td></tr>
    <tr><td class="paramname">FifoIntrId</td><td>is the interrupt id fifo.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>- XST_SUCCESS to indicate success.<ul>
<li>XST_FAILURE.to indicate failure.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None.</dd></dl>
<p>This function disables the interrupts that occur for AxiEthernet.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">IntcInstancePtr</td><td>is a pointer to the instance of the Intc component. </td></tr>
    <tr><td class="paramname">AxiEthernetIntrId</td><td>is the Interrupt ID and is typically XPAR_&lt;INTC_instance&gt;_&lt;AXIETHERNET_instance&gt;_VEC_ID value from xparameters.h. </td></tr>
    <tr><td class="paramname">FifoIntrId</td><td>is the interrupt id for fifo.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None.</dd></dl>

<p class="reference">References <a class="el" href="xaxiethernet__example_8h.html#ad700d3b9e292277d5437ecc4dc304dc3">AxiEthernetUtilErrorTrap()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Copyright &copy; 2015 Xilinx Inc. All rights reserved.</li>
  </ul>
</div>
</body>
</html>
